Skip to main content

Init + Create + Verify

At Mentaport, we aim to simplify the process for developers and creators to protect the authenticity of their content. We've broken down the process of watermarking, creating a certificate, and verifying it into three simple steps: Init, Create, and Verify.

NPM Install

npm install @mentaport/certificates

Checkout our examples to get started.

Initializing SDK

import { CertificateSDK } from '@mentaport/certificates';

To initialize the Certificate SDK, simply provide your API Key and an optional Environment parameter (the default setting is 'production').

Server Side Applications

For security purposes, we recommend using server-side applications. This way, your API Key will be highly protected. Checkout our examples to get started.

Init SDK in server-side only: (Recommended).

    // To call in the server
// Same for just client-only applications
_mentaportSDK = new CertificateSDK(apiKey);
_mentaportSDK.setClientEnv(env?:Environment);

Creating a Certificate

When creating a new certificate, we first watermark the content and approve the provided information. Once approved, the certificate is issued, and the newly watermarked content becomes available for download.

1. Creating a certificate

    /**
* Function to execute a certificte of content
* @param {ICertificateArg} ICertificateArg (name, title, etc)
* @param {blobContent} File to uplaod
*
* @returns {IResults<ICertificate>} Returns initializing certificate.
*/
const result = await _mentaportSDK.createCertificate(
initCertificateArgs: ICertificateArg,
blobContent:Blob);

Once the content is uploaded, the status of the certificate will change from 'NonActive' to 'Initialized'.

3. Check status for Pending Certificate

Depending on the type of content you are watermarking (image, audio, video), the watermarking process can vary in time, typically taking about 1-20 seconds. Check the status until the content has successfully been watermarked before proceeding.

   /**
* Function to create a watermark certificate
* @param {contractId} ContractId
* @param {certId} certId
*
* @returns {IResults<ICertStatusResult>} Returns certificate and status information.
*/
const result = await _mentaportSDK.getCertificateStatus(contractId:string, certId:string);

Once the content has succesfully been watermarked, the status will change from 'Initialized' to 'Pending'.

4. Approve Certificate

Approve the watermarked content and verify the information provided before creating the blockchain certificate. Once approved, the content will be available for download.

    /**
* Function to approve / non-approve a certificate before it generates NFT
*
* @param {contractId} ContractId
* @param {certId} certId from init content call
* @param {approve} Approve boolean
*
* @returns {IResults<ICertificate>} Returns certificate
*/
const result = await _mentaportSDK.approveCertificate(
contractId:string,
certId:string,
approved:boolean);

Once the certificate has been successfully approved, it will be executed on-chain, and the status will change to 'Active.'

5. Download Watermarked Content

Once the certificate has been successfully created, you're all set! Now you can download your newly watermarked content and distribute it fearlessly. Track it and rest assured that wherever it ends up, the provenance and ownership will be secure and traceable!

  /**
* Function to get download url of certificate
* @param {contractId} ContractId
* @param {certId} certId
*
* @returns {url} Returns url.
*/
const result = await _mentaportSDK.getDownloadUrl(contractId:string, certId:string);

Verify Content

The Mentaport SDK provides a straightforward method for checking if a piece of content contains a watermark and/or a C2PA manifest.

Start the verification process by uploading your content. Verification times range from approximately 1-20 seconds, depending on the size or length of the file uploaded (image, audio, video). After receiving the initial response, continue to check the status until you receive one of the following responses: 'NoCertificate' or 'Certified'.

    /**
* Function to verify if a piece of content has a certificate
* @param {contentFormat} contentFormat
* @param {urlFound} URL of where it was found
* @param {blobContent} content blob
*
* @returns {IResults<IVerify>} Returns verification status
*
*/
const result = await _mentaportSDK.verifyContent(
contentFormat:ContentFormat,
urlFound:string,
blobContent:Blob,
):

    /**
* Function to get verification progress status
* @param {verId} Id from verifyContent result
*
* @returns {IVerify} Returns verification status and certificate if found.
*/
const result = await _mentaportSDK.getVerificationStatus(verId:string):

Checkout our examples to get started.